// user-service/src/main/java/com/example/userservice/mq/RocketMQProducer.java
package com.example.userservice.mq;

import com.example.common.dto.OperationLogEvent;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class RocketMQProducer {

    private final RocketMQTemplate rocketMQTemplate;
    
    @Autowired
    public RocketMQProducer(RocketMQTemplate rocketMQTemplate) {
        this.rocketMQTemplate = rocketMQTemplate;
    }
    
    public void sendLogMessage(OperationLogEvent logEvent) {
        rocketMQTemplate.convertAndSend("OPERATION_LOG_TOPIC", logEvent);
    }
}